package cn.xiangxu.flux_server.controller;

import cn.xiangxu.flux_server.domain.domain_po.StudentPO;
import cn.xiangxu.flux_server.repository.StudentRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @author 王杨帅
 * @create 2018-08-21 22:08
 * @desc 测试控制层
 **/
@RestController
@RequestMapping(value = "/test")
@Slf4j
public class TestController {

    @Autowired
    private StudentRepository studentRepository;

    @GetMapping(value = "/connect")
    public String connect() {
        String result = "前后端连接测试成功——2018年8月21日22:09:17";
        log.info(result);
        return result;
    }

    @GetMapping(value = "/mongodbTest")
    public Flux<StudentPO> mongodbTest() {
        return studentRepository.findAll();
    }

}

